﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ServBus.ListForm2010.Setup.SubForms
{
    public partial class BaseStepForm : UserControl
    {
        private BaseStepForm previous;
        private BaseStepForm next;

        public BaseStepForm()
        {
            InitializeComponent();
        }

        public BaseStepForm(BaseStepForm previous, SetupForm setupForm)
        {
            InitializeComponent();
            this.previous = previous;
            this.ParentSetupForm = setupForm;
        }

        public BaseStepForm PreviousStep 
        {
            get
            {
                if (this.previous != null)
                    this.previous.Init();
                return this.previous;
            }
        }

        public BaseStepForm NextStep
        {
            get
            {
                if (this.next == null)
                {
                    this.next = CreateNextStep();
                    this.next.Init();
                    this.next.Execute();
                }
                else
                {
                    this.next.Init();
                }
                return this.next;
            }
        }

        public SetupForm ParentSetupForm
        {
            get;
            protected set;
        }

        public virtual string Title
        {
            get { return string.Empty; }
        }
        public virtual string SubTitle
        {
            get { return string.Empty; }
        }

        public virtual BaseStepForm CreateNextStep()
        {
            return null;
        }

        public virtual void Init()
        {
        }

        public virtual void Execute()
        {
        }

        public virtual void AbortSteup()
        {
            Application.Exit();
        }
    }
}
